@include('admin.public.__head')
    <!-- Main Container -->
    <div class="main-container container-fluid">
        <!-- Page Container -->
        <div class="page-container">

            <!-- Page Sidebar -->
            @include('admin.public.__left')
            <!-- /Page Sidebar -->
            <!-- Page Content -->
            <div class="page-content">
                <!-- Page Breadcrumb -->
                <div class="page-breadcrumbs">
                    <ul class="breadcrumb">
                        <li>
                            <i class="fa fa-home"></i>&nbsp;文章管理
                        </li>
                        <li>文章编辑</li>
                    </ul>
                </div>
                <!-- /Page Breadcrumb -->
                <!-- Page Body -->
                <div class="page-body">
                	<div class="row">
                		<div class="col-xs-12">
                			<div class="widget radius-bordered">
                				<div class="widget-header bordered-bottom bordered-themeprimary">
                					<span class="widget-caption">文章添加</span>
                				</div>
                				<div class="widget-body">
                					<form action="" class="form-horizontal">
                                        <input type="hidden" name="id" value="{{$articleInfo->id}}">
                						<div class="form-group">
                							<label for="title" class="control-label col-sm-2">文章标题</label>
                							<div class="col-sm-6">
                								<input type="text" class="form-control" id="title" name="title" placeholder="文章标题" value="{{$articleInfo->title}}" />
                							</div>
                						</div>
                						<div class="form-group">
                							<label for="tags" class="control-label col-sm-2">标签</label>
                							<div class="col-sm-6">
                								<input type="text" class="form-control" id="tags" name="tags" placeholder="标签" value="{{$articleInfo->tags}}" />
                                                <span class="help-block">标签用|分隔</span>
                							</div>
                						</div>
                						<div class="form-group">
                							<label for="member_id" class="control-label col-sm-2">作者</label>
                							<div class="col-sm-6">
                								<select name="member_id" class="form-control">
                									<option value="">请选择</option>
                                                    @foreach ($members as $vo)
                									<option value="{{$vo->id}}"
                                                    @if ($vo->id == $articleInfo->member_id)
                                                    selected
                                                    @endif
                                                    >{{$vo->nickname}}</option>
                                                    @endforeach
                								</select>
                							</div>
                						</div>
                						<div class="form-group">
                							<label for="cate_id" class="control-label col-sm-2">所属导航</label>
                							<div class="col-sm-6">
                								<select name="cate_id" class="form-control">
                									<option value="">请选择</option>
                                                    @foreach ($cates as $vo)
                									<option value="{{$vo->id}}"
                                                    @if ($vo->id == $articleInfo->cate_id)
                                                    selected
                                                    @endif
                                                    >{{$vo->catename}}</option>
                                                    @endforeach
                								</select>
                							</div>
                						</div>
                						<div class="form-group">
                							<label for="desc" class="control-label col-sm-2">文章概要</label>
                							<div class="col-sm-6">
                								<textarea name="desc" id="desc" cols="30" rows="5" class="form-control">{{$articleInfo->desc}}</textarea>
                							</div>
                						</div>
                						<div class="form-group">
                							<label for="content" class="control-label col-sm-2">文章内容</label>
                							<div class="col-sm-6">
                								<textarea name="content" id="content" cols="30" rows="10" class="">{{$articleInfo->content}}</textarea>
                							</div>
                						</div>
                						<div class="form-group">
                							<div class="col-sm-offset-2 col-sm-6">
                								<button type="submit" class="btn btn-primary" id="articleEdit">修改</button>
                							</div>
                						</div>
                					</form>
                				</div>
                			</div>
                		</div>
                	</div>
                </div>
                <!-- /Page Body -->
            </div>
            <!-- /Page Content -->

        </div>
        <!-- /Page Container -->
        <!-- Main Container -->

    </div>

    @include('admin.public.__js')
    <script src="/assets/lib/ueditor/ueditor.config.js"></script>
    <script src="/assets/lib/ueditor/ueditor.all.js"></script>
    <script>
        $(function () {
            UE.getEditor('content');

            $('#articleEdit').click(function () {
                $.ajax({
                    url:"{{url('admin/articleedit')}}",
                    type:'post',
                    data:$('form').serialize(),
                    dataType:'json',
                    success:function (data) {
                        if (data.code == 1) {
                            layer.msg(data.msg, {
                                icon:6,
                                time:2000
                            }, function () {
                                location.href = data.url;
                            });
                        }else {
                            layer.open({
                                title:'文章修改失败',
                                content:data.msg,
                                icon:5,
                                anim:6
                            });
                        }
                    }
                });
                return false;
            });
        });
    </script>
</body>
<!--  /Body -->
</html>
